//
//  KAHomeTipView.swift
//  kano
//
//  Created by Sophia on 2024/8/21.
//

import UIKit

class KAHomeTipView: UIView {
    lazy var var_cornerView: UIView = {
        let var_cornerView = UIView()
        var_cornerView.backgroundColor = UIColor.white
        var_cornerView.layer.cornerRadius = kscale(6)
        var_cornerView.layer.masksToBounds = true
        var_cornerView.frame = CGRectMake(kscale(16), kscale(12), width-kscale(32), kscale(28))
        return var_cornerView
    }()
    
    lazy var var_tipImg: UIImageView = {
        let var_tipImg = UIImageView(frame: CGRectMake(kscale(6), kscale(4), kscale(20), kscale(20)))
        var_tipImg.image = UIImage(named: "home_msgTip")
        return var_tipImg
    }()
    
    lazy var var_tipLabel: UILabel = {
        let var_tipLabel = UILabel()
        var_tipLabel.x = var_tipImg.right+kscale(6)
        var_tipLabel.y = var_tipImg.top
        var_tipLabel.width = var_cornerView.width-kscale(64)
        var_tipLabel.height = kscale(20)
        var_tipLabel.font = UIFont.systemFont(ofSize: kscale(12), weight: .regular)
        var_tipLabel.textColor = .color8A8891
        var_tipLabel.text = "Daily interest rate as low as 0.08%"
        return var_tipLabel
    }()
    
}

extension KAHomeTipView {
    
    convenience init() {
        self.init(frame: CGRect(x: 0, y: 0, width: var_screenWidth-kscale(32), height: kscale(52)))
        ka_setUI()
    }
    func ka_setUI() {
        backgroundColor = .colorF4F4FD
        addSubview(var_cornerView)
        var_cornerView.addSubview(var_tipImg)
        var_cornerView.addSubview(var_tipLabel)
    }
}
